package com.bwie.controller;

import com.bwie.service.TbUserService;
import com.bwie.utils.R;
import com.bwie.vo.LoginInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/7/15 10:45
 * @Description:
 **/
@RestController
@RequestMapping("/user/index")
public class IndexController {

    @Autowired
    TbUserService tbUserService;

    /**
     * 发送验证码
     * @param mobile
     * @return
     */
    @PostMapping("/sendCode/{mobile}")
    public R sendCode(@PathVariable("mobile") String mobile){
        return tbUserService.sendCode(mobile);
    }

    /**
     * 用户登录
     * @param loginInfoVo
     * @return
     */
    @PostMapping("/login")
    public R login(@RequestBody @Validated LoginInfoVo loginInfoVo){
        return tbUserService.login(loginInfoVo);
    }
}
